%% @author Marc Worrell <marc@worrell.nl>
%% @copyright 2012 Marc Worrell
%% @doc 'brlinebreaks' filter, translate <br/> elements into linebreaks

%% Copyright 2012 Marc Worrell
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%%     http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.

-module(filter_brlinebreaks).
-moduledoc("
See also

[linebreaksbr](/id/doc_template_filter_filter_linebreaksbr)

Translate HTML `<br/\\>` elements into ASCII newlines (`\\n`).

The following string:


```django
{{ \"foo<br/>bar\"|brlinebreaks }}
```

will evaluate to `foo\\nbar`.

**Note:** Non-closing line breaks (`<br\\>`) are currently not converted.
").
-export([brlinebreaks/2]).

brlinebreaks(S, Context) ->
    z_html:br2nl(z_convert:to_binary(S, Context)).

